package day5;

import java.util.Scanner;

import org.junit.Test;

public class Demo {
	public static void main(String[] args) {
		String str = "HelloWorld";
		String str2 = str.toUpperCase();
		System.out.println(str2);
		System.out.println(str.toUpperCase());// 大写
		str.toLowerCase();// 小写
	}
	
	@Test
	public void test2() {// 数组最主要的就是遍历
		Scanner scanner = new Scanner(System.in);
		String str1 = scanner.nextLine();
		char[] array = str1.toCharArray();
		for (int i = 0; i < array.length; i++) {
			if (array[i] >= 'A' && array[i] <= 'Z') {
//				// Type是类型，写任意一个类就是一个Type类型  un in mis
//				array[i] = array[i] + 32;// Type mismatch: cannot convert from int to char
				array[i] = (char)(array[i] + 32);
			} else if(array[i] >= 'a' && array[i] <= 'z') {
				array[i] = (char)(array[i] - 32);
			}
		}
		String str2 = new String(array);
		System.out.println(str2);
	}
	
	@Test
	public void test3() {
		//Java中Char和整型只要不超出范围就可以自动转换
		char ch1 = 'A' + 32;
		char ch2 = 97;// 97没有超过char类型的范围，所以不需要强制转换
		System.out.println(ch1 + "" + ch2);
	}
	
	@Test
	public void test4() {
		for (int i = 1; i <= 9; i++) {
			for (int j = 1; j <= i; j++) {
				System.out.print(j + "*" + i + "=" + (i * j) + "\t");
			}
			System.out.println();
		}
	}
}
